Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for ENC424J600 with bumped minimq #156

Merged
merged 20 commits into from
Sep 30, 2021

Conversation

HarryMakes
Copy link
Contributor

@HarryMakes HarryMakes commented Sep 27, 2021

Because of a careless mistake in my .git/config, I have pushed a merge of my original PR #154 to this upstream remote, which inadvertently also merged and closed that PR. This was never an intention and my PR still requires final review and confirmation by @ryan-summers and/or @jordens.

Therefore, I am opening a duplicate PR here, with some minor additional commits to what has already been reviewed in #154. Prior to this merge, I have force-pushed this upstream develop branch back to the original head (4ef6c80). Please kindly make all necessary corrections/actions if this is still the wrong develop head - Thank you with much apologies!


Summary

This PR is directly cloned from #154.

Key Changes

(based on #154)

  • Introduce Cargo feature phy_enc424j600 for implementing MQTT client functionality with ENC424J600 controller
  • Upon reboot, apply Booster's EEPROM EUI48 to ENC424J600's volatile RAM as MAC address
  • Bump minimq to quartiq/minimq@d2ec3e8
  • In following situations, eliminate panics or watchdog triggers on ENC424J600's variant while keeping trying to resume network connection:
    • MQTT broker IP address is invalid or currently cannot be connected
  • Adopts smoltcp-nal 0.1.0 to implement the NAL stack required by minimq.
  • Creates variants for CI.

Testing

Network connection and MQTT features remain functional for both ENC424J600 variant on v1.4 User IFC board and W5500 variant on v1.3 User IFC board (using default crate features).

Issues to be resolved independently

  • MQTT client will not reconnect to the broker after disconnection.
  • PHY linkup is not actively monitored, so if it is unplugged from the network, the socket TCP state keeps at ESTABLISHED (because there is no timeout/keepalive/socket close()), meaning in #[telemetry] the MQTT client will keep calling publish() to queue in the socket TX buffer until it is full, and keep emitting WriteFail errors.

occheung and others added 17 commits June 16, 2021 13:16
(afdab5f) cargo: include enc424j600 dependencies

(39e0b55) main: feature gate different eth device

(e845f56) nal: implement enc424j600 variant

(befe70a) nal: fix unnecessary w5500 dependencies

(20efdcc) settings: override eeprom MAC

(0d90470) use cargo fmt

(6e13f4f) cargo: add w5500 as default

(83380a9) cargo: simplify smoltcp dependency

(83109c3) settings/mac: remove redundant code

(a3db62f) mac: use smoltcp

(15f0964) eth_cfg: split off from main

(4ae6e82) nal: migrated to enc424j600

(e66d916) phy_config: minor fix

(3869217) clean up
* This also tells the ENC424J600 driver to use Cortex-M instructions to perform SPI CS_n delays at the current firmware CPU clock frequency.
* mqtt_control: Also fix missing feature gate for W5500
@HarryMakes
Copy link
Contributor Author

With 8055090, I've edited the GitHub workflows matrix such that --no-default-features is always on for cargo, and the Eth controller variant is controlled as a separate feature parameter. This would make it easier to expand for more crate features such as I2C bitbanging in the future.

Copy link
Member

@ryan-summers ryan-summers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good to me, although I have no means of testing this code. If your testing is looking good, I'm happy to merge these additions.

src/mqtt_control.rs Outdated Show resolved Hide resolved
@ryan-summers ryan-summers merged commit 740df7f into develop Sep 30, 2021
@ryan-summers ryan-summers deleted the feature/enc424j600_merged branch September 30, 2021 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants